package com.jc.gameconter.controller.index;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jc.business.userorder.UserOrderBusiness;
import com.jc.framework.web.ResponseBaseModel;
import com.jc.framework.web.ResponseResultModel;
import com.jc.gameconter.controller.BaseController;

@Controller
@RequestMapping("index")
public class IndexController extends BaseController {
	
	@Autowired
	UserOrderBusiness userOrderBusiness;
	
	@RequestMapping(value="/orderlist",method = RequestMethod.POST)
	public @ResponseBody ResponseEntity<?> orderlist(HttpServletRequest request,Integer orderType, String userId,Integer pageNum,Integer pageSize) {
		try {
			
			if(StringUtils.isBlank(userId)) {
				return new ResponseEntity<>(new ResponseBaseModel(29002,"缺少参数userId"), HttpStatus.OK);
			}
			if(pageNum == null) pageNum = 1;
			if(pageSize == null) pageSize = 15;
			List<Map<String,Object>> _list = userOrderBusiness.queryOrderHistory(orderType,userId, pageNum, pageSize);
			return new ResponseEntity<>(new ResponseResultModel<List<Map<String,Object>>>(_list),HttpStatus.OK);
		}catch(Exception e) {
			this.getLoger().error("查询交易历史异常 {} , {}", e.getMessage(),e);
			return new ResponseEntity<>(new ResponseBaseModel(29002,e.getMessage()), HttpStatus.OK);
		}
	}
	
	
	@RequestMapping(value="/noticVrt",method = RequestMethod.POST)
	public @ResponseBody ResponseEntity<?> noticVrt(HttpServletRequest request, String orderId) {
		
		try {
			
			
			
		}catch(Exception e) {
			
		}
		
		return null;
	}

}
